package ru.home.documentmanager.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import ru.home.documentmanager.dao.UserDataDAO;
import ru.home.documentmanager.model.User;
import ru.home.documentmanager.model.UserData;
import ru.home.documentmanager.service.UserDataService;

@Service("userDataService")
public class UserDataServiceImpl implements UserDataService {

    @Resource
    private UserDataDAO userDataDAO;

    @Override
    @Transactional
    public void save(UserData object) {
        userDataDAO.save(object);
    }

    @Override
    @Transactional
    public void update(UserData object) {
        userDataDAO.update(object);
    }

    @Override
    @Transactional
    public void saveOrUpdate(UserData object) {
        userDataDAO.saveOrUpdate(object);
    }

    @Override
    @Transactional
    public void delete(UserData object) {
        userDataDAO.delete(object);
    }

    @Override
    @Transactional
    public List<UserData> find() {
        return userDataDAO.find();
    }

    @Override
    @Transactional
    public UserData find(long id) {
        return userDataDAO.find(id);
    }

    @Override
    @Transactional
    public UserData findByUser(User user) {
        return userDataDAO.findByUser(user);
    }

    @Override
    public void delete(long id) {
        userDataDAO.delete(id);
    }

}
